# ------------------------------------------------------------------------------------------------------------------
# 这段代码定义了一个CMake宏 __add_xg_platform_dependencies，该宏旨在根据不同目标平台向给定的目标（target）添加特定的平台依赖项和编译定义。
# ------------------------------------------------------------------------------------------------------------------

macro(__add_xg_platform_dependencies target)
if(WIN32)
    add_definitions(-DGUID_WINDOWS)
elseif(APPLE)
    find_library(CFLIB CoreFoundation)
    target_link_libraries(${target} ${CFLIB})
    add_definitions(-DGUID_CFUUID)
    set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -pedantic")
elseif(ANDROID)
    target_compile_definitions(${target} PRIVATE GUID_ANDROID)
elseif(CMAKE_SYSTEM_NAME MATCHES Orbis)
    # nothing here
else()
    find_package(Libuuid REQUIRED)
    if (NOT LIBUUID_FOUND)
        message(FATAL_ERROR
            "You might need to run 'sudo apt-get install uuid-dev' or similar")
    endif()
    include_directories(${LIBUUID_INCLUDE_DIR})
    target_link_libraries(${target} ${LIBUUID_LIBRARY})
    add_definitions(-DGUID_LIBUUID)
    set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -pedantic")
endif()
endmacro()